sm.scrapcomputers
All data inside the sm.scrapcomputers namespace!
You don't have to load this at all, The sm table is globably shared across mods, this means once its loaded. you can access it in any mod, even if you didnt load it.
It's suggested to still load the config file in the AutoTool scripts so it can load as soon as possible as Scrap Mechanic loads the mods from newest to oldest.
Variables
sm.scrapcomputers.backend
A table relating to special backend activities that need to happen between components
sm.scrapcomputers.backend = {}
sm.scrapcomputers.dataList
Contains all functions, data (or whatever). Eg: Displays is a list of all displays in ScrapComputers.
sm.scrapcomputers.dataList = {
["Displays"] = {},
["Harddrives"] = {},
["Holograms"] = {},
["Terminals"] = {},
["Radars"] = {},
["InputRegisters"] = {},
["OutputRegisters"] = {},
["NetworkPorts"] = {},
["Antennas"] = {},
["Cameras"] = {},
["Speakers"] = {},
["Keyboards"] = {},
["Motors"] = {},
["Lasers"] = {},
["GPSs"] = {},
["SeatControllers"] = {},
["GravityControllers"] = {},
["NetworkInterfaces"] = {}
}
sm.scrapcomputers.types
A more complete version of sm.types. The game's own sm.types is missing a lot of userdata types, so this table maps both ways: a type's name to its numeric id, and the numeric id back to its name.
sm.scrapcomputers.types[3] -- "number"
sm.scrapcomputers.types["Vec3"] -- 10003
sm.scrapcomputers.types[10003] -- "Vec3"
Contents:
- Lua types (
0-8):nil,boolean,lightUserdata,number,string,table,function,userdata,thread - Value userdata (
10001-10008):Uuid,Vec3,Quat,Color,RaycastResult,LoadCellHandle,Effect. (10002is not used.) - Game object userdata (
10021-10045):Shape,Body,Interactable,Container,Harvestable,Network,World,Unit,Storage,Player,Character,Joint,AiState,Quest,AreaTrigger,Portal,PathNode,Lift,ScriptableObject,BuilderGuide,CullSphereGroup,VoxelTerrain,JsonGui,JsonWidget,ClientScriptableObject - Tool & GUI userdata (
20002,20006-20008):Tool,GuiInterface,BlueprintVisualization,Garage
A copy of this table is also given to computers as sm.types (see the Lua API's Global Variables page).
sm.scrapcomputers.privateDataPrefix
Prefix used to hide variables and tables inside component's computer api. If you put any variable or function in a compoonent that starts with this, it will not show in the computer api, BUT you can stil access it via getComponents ASLONG if getPrivateData is true
sm.scrapcomputers.privateDataPrefix = "SC_PRIVATE_"
Functions
toString
sm.scrapcomputers.toString( value )
Converts a value to a string, Better than lua's tostring
Arguments:
- value [ any ] the value to convert
Returns:
- [ string ] The converted value as a string